package java17demo;

public class SwitchMain {
	public static void main(String[] args) {
		String day = "Monday";

		String r = switch (day) { // switch表达式
		case "Monday", "Tuesday", "Wednesday", "Thursday", "Friday" -> {
			System.out.println("进入分支1");
			yield "工作日"; // 相当于return "工作日"
		}
		case "Saturday", "Sunday" -> "休息日"; // 无需break与yield，直接返回
		default -> throw new IllegalArgumentException("输入错误");
		};

		System.out.println(day + "是" + r);
	}
}